import { GetGroupTreeList } from '@/common';
import { TreeData } from '@/types/dataset';

export const getStatus = (reviewStatus: string) => {
  return reviewStatus === 'upload_publish'
    ? '审批中'
    : reviewStatus === 'upload_reject'
      ? '上传驳回'
      : reviewStatus === 'delete_reject'
        ? '删除驳回'
        : reviewStatus === 'upload_pass' || reviewStatus === 'delete_pass'
          ? '已入库'
          : reviewStatus === 'delete_publish'
            ? '删除、审批中'
            : '-';
};

export const getIsEditPermission = (users: GetGroupTreeList[], node: TreeData) => {
  return Array.isArray(users) && users.some((item: any) => item?.id === node.groupId);
};
